home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 1997 November / Pcwk1197.iso / LOTUS / Eng-ins / SMASTERS / APPROACH / DB2WWW.MPR / SCRIPT / ApproachDoc / WWW Assistant / Body / btnP1ReadMe.s (.txt) < prev    next >
Null Bytes Alternating  |  1997-01-09  |  24KB  |  414 lines

  1. '++LotusScript Development Environment:2:5:(Options):0:66
  2.  
  3. '++LotusScript Development Environment:2:5:(Forward):0:1
  4. Declare Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
  5. Declare Function FindBrowser As String
  6. Declare Function FindSmartMasterDir As String
  7. Declare Function FindNotePad As String
  8. Declare Sub Sub2
  9. Declare Function FindNTBrowser As String
  10. Declare Function FindNTNotepad As String
  11. Declare Function FindNTSmasters As String
  12.  
  13. '++LotusScript Development Environment:2:5:(Declarations):0:2
  14.  
  15. '++LotusScript Development Environment:2:2:BindEvents:1:129
  16. Private Sub BindEvents(Byval Objectname_ As String)
  17.     Static Source As BUTTON
  18.     Set Source = Bind(Objectname_)
  19.     On Event Click From Source Call Click
  20. End Sub
  21.  
  22. '++LotusScript Development Environment:2:2:Click:1:12
  23. Sub Click(Source As Button, X As Long, Y As Long, Flags As Long)
  24.     On Error Resume Next
  25.     Dim pathReadme, npath, mybrowser As String
  26.     
  27.     pathReadme = FindSmartMasterDir
  28.     
  29.     
  30.     
  31.     findReadme = Dir(pathReadme & "Readme.htm")
  32.     
  33.     'Check on NT:
  34.     If findReadme="" Then
  35.         pathReadme=FindNTSmasters
  36.     End If
  37.     
  38.     findReadme = Dir(pathReadme & "Readme.htm")
  39.     
  40.     If findReadme = "" Then 'If we couldn't locate the readme's on either win95 or NT,
  41.         Msgbox "Could Not Locate Readme" & Chr(10) & "Please check installation of smartmaster",,"Error Locating ReadMe"
  42.         Exit Sub
  43.     End If
  44.     
  45.     MyBrowser = FindBrowser    
  46.     
  47.     If MyBrowser="" Then 'Check on NT
  48.         MyBrowser=FindNTBrowser
  49.     End If
  50.     
  51.     If MyBrowser = "" Then ' Must not have found the browser on win95 or NT
  52.         npath = FindNotepad
  53.         If npath="" Then 'check on NT,
  54.             npath=FindNTNotepad
  55.         End If
  56.         On Error Resume Next
  57.         rval = Shell( npath + " " + pathReadme + "Readme.txt")
  58.         Activateapp("readme")
  59.         Sendkeys "~~", 0
  60.         Exit Sub
  61.     End If
  62.     
  63.     
  64.     'Format pathReadme for URL address:
  65.     pathReadme = Left$(pathReadme,1) & "|" & Right$(pathReadme, (Len(pathReadme)-2))
  66.     rval = Shell(MyBrowser & " file:///" & pathReadme & "Readme.htm")
  67.     On Error Resume Next
  68.     Activateapp("Netscape")
  69.     Sendkeys "~~", 0
  70.     
  71.     Err = 0
  72. End Sub
  73.  
  74. '++LotusScript Development Environment:2:1:FindBrowser:1:8
  75. Function FindBrowser As String
  76.     
  77.     Dim happkey As Long
  78.     Dim HKEY_LOCAL_MACHINE As Long
  79.     Dim KEY_READ As Long
  80.     Dim HKEY_CURRENT_USER As Long
  81.     Dim HKEY_CLASSES_ROOT As Long
  82.     Dim ValueType As Long
  83.     Dim ReturnedKeyContents As String * 255
  84.     Dim readbytes As Long
  85.     Dim ReturnString As String * 255
  86.     MaxBytes%=Len(ReturnString$)
  87.     IniFileName$ = "Win.Ini"
  88.     ReturnedKeycontents$=String$(255,Chr$(32))
  89.     
  90.     HKEY_CLASSES_ROOT= &H80000000
  91.     HKEY_CURRENT_USER= &H80000001
  92.     HKEY_LOCAL_MACHINE= &H80000002
  93.     
  94.     KEY_QUERY_VALUE=1
  95.     KEY_ENUMERATE_SUBKEYS=8
  96.     KEY_NOTIFY=16
  97.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  98.     
  99.     KeyName$="http\shell\open\command"
  100.     
  101.     ValueName$=""
  102.         'lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  103.     lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  104.     ReadBytes=255
  105.     lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  106.     regclosekey(happkey)
  107.     If Trim$(ReturnedKeyContents$)="" Then
  108.         'The DB2 Web Sizing Assistant Cannot Locate Your Browser
  109.         FindBrowser=""
  110.         Exit Function
  111.     End If
  112.     BrowserPath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  113.     BrowserPath$=Lcase$(BrowserPath$)
  114.     
  115.     ExePos=Instr(BrowserPath$,".exe")
  116.     If ExePos<>0 Then
  117.         'Strip off the extra ending quote and command line parameters    
  118.         BrowserPath$=Left$(BrowserPath$,ExePos+3)
  119.     End If
  120.     
  121.         ' return path without leading quote, if there is one:
  122.     QuotePos=Instr(BrowserPath$,Chr$(34))
  123.     If QuotePos<>0 Then
  124.         BrowserPath$=Mid$(BrowserPath$,QuotePos+1)
  125.     End If
  126.     
  127.     FindBrowser=BrowserPath$
  128. End Function
  129. '++LotusScript Development Environment:2:1:FindSmartMasterDir:1:8
  130. Function FindSmartMasterDir As String
  131.     
  132.     
  133.     Dim happkey As Long
  134.     Dim HKEY_LOCAL_MACHINE As Long
  135.     Dim KEY_READ As Long
  136.     Dim HKEY_CURRENT_USER As Long
  137.     Dim HKEY_CLASSES_ROOT As Long
  138.     Dim ValueType As Long
  139.     Dim ReturnedKeyContents As String * 255
  140.     Dim readbytes As Long
  141.     Dim ReturnString As String * 255
  142.     MaxBytes%=Len(ReturnString$)
  143.     IniFileName$ = "Win.Ini"
  144.     ReturnedKeycontents$=String$(255,Chr$(32))
  145.     
  146.     HKEY_CLASSES_ROOT= &H80000000
  147.     HKEY_CURRENT_USER= &H80000001
  148.     HKEY_LOCAL_MACHINE= &H80000002
  149.     
  150.     KEY_QUERY_VALUE=1
  151.     KEY_ENUMERATE_SUBKEYS=8
  152.     KEY_NOTIFY=16
  153.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  154.     
  155.     
  156.     KeyName$="Software\Lotus\approach\97.0\Paths\SMasters"
  157.     ValueName$="EN"
  158.     
  159.     lstat=RegOpenKeyExA(HKEY_CURRENT_USER,KeyName$,0,KEY_READ,happkey)
  160.     ReadBytes=255
  161.     lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  162.     regclosekey(happkey)
  163.     If Trim$(ReturnedKeyContents$)="" Then
  164.         'Messagebox("The DB2 Web Sizing Assistant Cannot Find Readme.")
  165.         FindSmartMasterDir=""
  166.         Exit Function
  167.     End If
  168.     ReadMePath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  169.     
  170.         ' return path without leading quote, if there is one:
  171.     QuotePos=Instr(ReadMePath$,Chr$(34))
  172.     If QuotePos<>0 Then
  173.         ReadMePath$=Mid$(ReadMePath$,QuotePos+1)
  174.     End If
  175.     
  176.     FindSmartMasterDir=ReadMePath$
  177.     
  178. End Function
  179. '++LotusScript Development Environment:2:1:FindNotePad:1:8
  180. Function FindNotePad As String
  181.     Dim happkey As Long
  182.     Dim HKEY_LOCAL_MACHINE As Long
  183.     Dim KEY_READ As Long
  184.     Dim HKEY_CURRENT_USER As Long
  185.     Dim HKEY_CLASSES_ROOT As Long
  186.     Dim ValueType As Long
  187.     Dim ReturnedKeyContents As String * 255
  188.     Dim readbytes As Long
  189.     Dim ReturnString As String * 255
  190.     MaxBytes%=Len(ReturnString$)
  191.     IniFileName$ = "Win.Ini"
  192.     ReturnedKeycontents$=String$(255,Chr$(32))
  193.     
  194.     HKEY_CLASSES_ROOT= &H80000000
  195.     HKEY_CURRENT_USER= &H80000001
  196.     HKEY_LOCAL_MACHINE= &H80000002
  197.     
  198.     KEY_QUERY_VALUE=1
  199.     KEY_ENUMERATE_SUBKEYS=8
  200.     KEY_NOTIFY=16
  201.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  202.     
  203.     KeyName$="txtfile\shell\open\command"
  204.     
  205.     ValueName$=""
  206.         'lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  207.     lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  208.     ReadBytes=255
  209.     lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  210.     regclosekey(happkey)
  211.     If Trim$(ReturnedKeyContents$)="" Then
  212.         'The DB2 Web Sizing Assistant Cannot Locate Your Browser
  213.         FindNotePad = ""
  214.         Exit Function
  215.     End If
  216.     NPath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  217.     NPath$=Lcase$(NPath$)
  218.     
  219.     ExePos=Instr(NPath$,".exe")
  220.     If ExePos<>0 Then
  221.         'Strip off the extra ending quote and command line parameters    
  222.         NPath$=Left$(NPath$,ExePos+3)
  223.     End If
  224.     
  225.         ' return path without leading quote, if there is one:
  226.     QuotePos=Instr(NPath$,Chr$(34))
  227.     If QuotePos<>0 Then
  228.         NPath$=Mid$(NPath$,QuotePos+1)
  229.     End If
  230.     'Check to see if this is a value from NT 4.0:
  231.     If Left(Lcase$(NPath$), 12) = "%systemroot%" Then
  232.         NPath$ = "notepad"
  233.     End If
  234.     FindNotePad=NPath$
  235. End Function
  236. '++LotusScript Development Environment:2:2:Sub2:1:8
  237. Sub Sub2
  238.     pathReadme = FindSmartMasterDir
  239.     
  240.     findReadme = Dir(pathReadme & "Readme.htm")
  241.     
  242.     'Check on NT:
  243.     If findReadme="" Then
  244.         pathReadme=FindNTSmasters
  245.     End If
  246.     
  247.     findReadme = Dir(pathReadme & "Readme.htm")
  248.     
  249.     If MyBrowser = "" Then ' Must not have found the browser on win95 or NT
  250.         npath = FindNotepad
  251.         If npath="" Then 'check on NT,
  252.             npath=FindNTNotepad
  253.         End If
  254.         On Error Resume Next
  255.         rval = Shell( npath + " " + pathReadme + "Readme.txt")
  256.         Exit Sub
  257.     End If
  258.     
  259. End Sub
  260. '++LotusScript Development Environment:2:1:FindNTBrowser:1:8
  261. Function FindNTBrowser As String
  262.     Dim happkey As Long
  263.     Dim HKEY_LOCAL_MACHINE As Long
  264.     Dim KEY_READ As Long
  265.     Dim HKEY_CURRENT_USER As Long
  266.     Dim HKEY_CLASSES_ROOT As Long
  267.     Dim ValueType As Long
  268.     Dim ReturnedKeyContents As String * 255
  269.     Dim readbytes As Long
  270.     Dim ReturnString As String * 255
  271.     MaxBytes%=Len(ReturnString$)
  272.     IniFileName$ = "Win.Ini"
  273.     ReturnedKeycontents$=String$(255,Chr$(32))
  274.     
  275.     HKEY_CLASSES_ROOT= &H80000000
  276.     HKEY_CURRENT_USER= &H80000001
  277.     HKEY_LOCAL_MACHINE= &H80000002
  278.     
  279.     KEY_QUERY_VALUE=1
  280.     KEY_ENUMERATE_SUBKEYS=8
  281.     KEY_NOTIFY=16
  282.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  283.     
  284.     KeyName$="NetscapeMarkup\shell\open\command\"
  285.     
  286.     ValueName$=""
  287.         'lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  288.     lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  289.     ReadBytes=255
  290.     lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  291.     regclosekey(happkey)
  292.     If Trim$(ReturnedKeyContents$)="" Then
  293.         'The DB2 Web Sizing Assistant Cannot Locate Your Browser
  294.         FindNTBrowser=""
  295.         Exit Function
  296.     End If
  297.     BrowserPath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  298.     BrowserPath$=Lcase$(BrowserPath$)
  299.     
  300.     ExePos=Instr(BrowserPath$,".exe")
  301.     If ExePos<>0 Then
  302.         'Strip off the extra ending quote and command line parameters    
  303.         BrowserPath$=Left$(BrowserPath$,ExePos+3)
  304.     End If
  305.     
  306.         ' return path without leading quote, if there is one:
  307.     QuotePos=Instr(BrowserPath$,Chr$(34))
  308.     If QuotePos<>0 Then
  309.         BrowserPath$=Mid$(BrowserPath$,QuotePos+1)
  310.     End If
  311.     
  312.     FindNTBrowser=BrowserPath$
  313. End Function
  314. '++LotusScript Development Environment:2:1:FindNTNotepad:1:8
  315. Function FindNTNotepad As String
  316.     Dim happkey As Long
  317.     Dim HKEY_LOCAL_MACHINE As Long
  318.     Dim KEY_READ As Long
  319.     Dim HKEY_CURRENT_USER As Long
  320.     Dim HKEY_CLASSES_ROOT As Long
  321.     Dim ValueType As Long
  322.     Dim ReturnedKeyContents As String * 255
  323.     Dim readbytes As Long
  324.     Dim ReturnString As String * 255
  325.     MaxBytes%=Len(ReturnString$)
  326.     IniFileName$ = "Win.Ini"
  327.     ReturnedKeycontents$=String$(255,Chr$(32))
  328.     
  329.     HKEY_CLASSES_ROOT= &H80000000
  330.     HKEY_CURRENT_USER= &H80000001
  331.     HKEY_LOCAL_MACHINE= &H80000002
  332.     
  333.     KEY_QUERY_VALUE=1
  334.     KEY_ENUMERATE_SUBKEYS=8
  335.     KEY_NOTIFY=16
  336.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  337.     
  338.     KeyName$="txtfile\shell\open\command\"
  339.     
  340.     ValueName$=""
  341.         'lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  342.     lstat=RegOpenKeyExA(HKEY_CLASSES_ROOT,KeyName$,0,KEY_READ,happkey)
  343.     ReadBytes=255
  344.     lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  345.     regclosekey(happkey)
  346.     If Trim$(ReturnedKeyContents$)="" Then
  347.         'The DB2 Web Sizing Assistant Cannot Locate Your Browser
  348.         FindNTNotePad = ""
  349.         Exit Function
  350.     End If
  351.     NPath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  352.     NPath$=Lcase$(NPath$)
  353.     
  354.     ExePos=Instr(NPath$,".exe")
  355.     If ExePos<>0 Then
  356.         'Strip off the extra ending quote and command line parameters    
  357.         NPath$=Left$(NPath$,ExePos+3)
  358.     End If
  359.     
  360.         ' return path without leading quote, if there is one:
  361.     QuotePos=Instr(NPath$,Chr$(34))
  362.     If QuotePos<>0 Then
  363.         NPath$=Mid$(NPath$,QuotePos+1)
  364.     End If
  365.     
  366.     FindNTNotePad=NPath$
  367. End Function
  368. '++LotusScript Development Environment:2:1:FindNTSmasters:1:8
  369. Function FindNTSmasters As String
  370.     Dim happkey As Long
  371.     Dim HKEY_LOCAL_MACHINE As Long
  372.     Dim KEY_READ As Long
  373.     Dim HKEY_CURRENT_USER As Long
  374.     Dim HKEY_CLASSES_ROOT As Long
  375.     Dim ValueType As Long
  376.     Dim ReturnedKeyContents As String * 255
  377.     Dim readbytes As Long
  378.     Dim ReturnString As String * 255
  379.     MaxBytes%=Len(ReturnString$)
  380.     IniFileName$ = "Win.Ini"
  381.     ReturnedKeycontents$=String$(255,Chr$(32))
  382.     
  383.     HKEY_CLASSES_ROOT= &H80000000
  384.     HKEY_CURRENT_USER= &H80000001
  385.     HKEY_LOCAL_MACHINE= &H80000002
  386.     
  387.     KEY_QUERY_VALUE=1
  388.     KEY_ENUMERATE_SUBKEYS=8
  389.     KEY_NOTIFY=16
  390.     KEY_READ=KEY_QUERY_VALUE Or KEY_ENUMERATE_SUBKEYS Or KEY_NOTIFY
  391.     
  392.     
  393.     KeyName$="Software\Lotus\approach\97.0\Paths\SMasters"
  394.     ValueName$="EN"
  395.     
  396.     lstat=RegOpenKeyExA(HKEY_CURRENT_USER,KeyName$,0,KEY_READ,happkey)
  397.     ReadBytes=255
  398.     lstat=RegQueryValueExA(happkey,ValueName$,0,valueType, ReturnedKeyContents$,ReadBytes)
  399.     regclosekey(happkey)
  400.     If Trim$(ReturnedKeyContents$)="" Then
  401.         'Messagebox("The DB2 Web Sizing Assistant Cannot Find Readme.")
  402.         FindNTSmasters=""
  403.         Exit Function
  404.     End If
  405.     ReadMePath$=Left$(ReturnedKeyContents$,ReadBytes-1)
  406.     
  407.         ' return path without leading quote, if there is one:
  408.     QuotePos=Instr(ReadMePath$,Chr$(34))
  409.     If QuotePos<>0 Then
  410.         ReadMePath$=Mid$(ReadMePath$,QuotePos+1)
  411.     End If
  412.     
  413.     FindNTSmasters=ReadMePath$
  414. End Function